package com.rrym.customer.controller;

import com.rrym.customer.client.TestClient;
import com.rrym.customer.entity.User;
import com.rrym.customer.mapper.UserMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author xiao
 * @Description:
 * @Date 2020/8/22 11:04 上午
 */
@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    private TestClient testClient;
    @Autowired
    private UserMapper userMapper;

    @GetMapping
    @GlobalTransactional
    public String getTest(){
        System.out.println("feign 进来了");
        User user=new User();
        user.setAge(18);
        user.setEmail("737775705@qq.com");
        user.setName("bepo");
        userMapper.insert(user);
        testClient.testMethod();
        return "进来咯";
    }


}
